package jsr166.contrib.uncontended;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * This lock class does nothing; no checking or locking of any kind.
 * It is provided so that you write code to use a lock that
 * is selected to be either a NoOpUncontendedLock (which will have no
 * performance penalty) or a UncontendedLock (which has some performance
 * penalty but checks for unexpected lock contention).
 * 
 * @author pugh
 *
 */
public class NoOpUncontendedLock implements Lock {

    public void lock() {

    }

    public void lockInterruptibly() throws InterruptedException {

    }

    public Condition newCondition() {
        return new UnusableCondition();
    }

    public boolean tryLock() {
        return true;
    }

    public boolean tryLock(long arg0, TimeUnit arg1) throws InterruptedException {
        return true;
    }

    public void unlock() {

    }

}
